#ifndef SRC_CLIENT_SIMULATOR_RTSP_CLIENT_MANAGER_H_
#define SRC_CLIENT_SIMULATOR_RTSP_CLIENT_MANAGER_H_

#include "client_simulator/rtsp_client.h"
#include "client_simulator/config.h"

class RtspClientManager : public noncopyable,
  public std::enable_shared_from_this<RtspClientManager>,
  public sigslot::has_slots<> {
 public:
  typedef std::shared_ptr<RtspClientManager> Ptr;
  RtspClientManager(Config::Ptr config, EventLoop::Ptr event_loop);
  virtual ~RtspClientManager();

 public:
  void Start();

 private:
  void OnRtspClientHello();

  void OnRtspClientClosed(RtspClient::Ptr rtsp_client);

  bool GetPDNS(const std::string &sn, int port,
               std::string &mapping_ip, int &mapping_port);

  bool SaveResult();

 private:
  Config::Ptr config_;
  EventLoop::Ptr event_loop_;
  std::list<RtspClient::Ptr> rtsp_clients_;
};

#endif  // SRC_CLIENT_SIMULATOR_RTSP_CLIENT_MANAGER_H_
